package com.bluemsun.naturallanguageprocessing.exceptionHandler;

import com.bluemsun.naturallanguageprocessing.common.ServerResponse;
import org.apache.ibatis.exceptions.PersistenceException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class DataBaseExceptionHandler {
    @ExceptionHandler(PersistenceException.class)
    public ServerResponse persistenceException(PersistenceException e){
        return ServerResponse.createByErrorMessage(e.getMessage());
    }
}
